<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:br />
<xp:br />
<xe:restService id="restService1">
<xe:this.service>
<xe:viewItemFileService viewName="AllContacts"
defaultColumns="true" contentType="application/json" var="entry">
<xp:this.columns>
<xe:restViewColumn name="ShortName">
<xp:this.value><![CDATA[#{javascript:var e = entry.getColumnValue("EMail")
if(e) {
var p = @UpperCase(@Left(e,"@"))
return p
}
return ""}]]></xp:this.value>
</xe:restViewColumn>
</xp:this.columns>
</xe:viewItemFileService>
</xe:this.service>
</xe:restService>
<xe:djxDataGrid id="djxDataGrid1"
style="width: 85em;height: 25em;padding: 1px" storeComponentId="restService1">
<!--
style="width: 85em;height: 25em;padding: 1px"
storeComponentId="restService1"> style="width: 85em;height:
25em;padding: 1px" store="restService3">
-->
<xe:djxDataGridColumn id="djxDataGridColumn6"
field="FirstName" width="auto" editable="true">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn7"
field="LastName" width="auto" editable="true">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn8"
field="City" width="auto">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn9"
field="EMail" width="auto">
</xe:djxDataGridColumn>
<xe:djxDataGridColumn id="djxDataGridColumn10"
field="ShortName" width="auto">
</xe:djxDataGridColumn>
</xe:djxDataGrid>
<xp:br />
<xp:br />
<!-- GridViewで選択された行のUNIDを取得して表示 -->
<xp:link escape="true" id="link2" text="選択された行文書のUNIDを取得">
<xp:eventHandler event="onclick" submit="false" immediate="false"
save="false">
<xp:this.script><![CDATA[var grid = dijit.byId('#{id:djxDataGrid1}');
var items = grid.selection.getSelected();
if(items.length) {
dojo.forEach(items, function(selectedItem) {
if(selectedItem!==null) {
dojo.forEach(grid.store.getAttributes(selectedItem), function(attribute){
var value = grid.store.getValues(selectedItem, attribute);
// alert('attribute: ' + attribute + ', value: ' + value);
if(attribute === '@unid'){
alert("選択されたUNID: "+value);
}
});
}
});
}
]]></xp:this.script>
</xp:eventHandler>
</xp:link>
</xp:view>